/*
 * @Descripttion:
 * @version:
 * @Author: congsir
 * @Date: 2023-10-20 22:17:08
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-10-24 21:13:30
 */
import { getHomeGoodPriceData } from "@/services";
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";

export const fetchHomeDataAction = createAsyncThunk(
  "fetchdata",
  (_, { dispatch }) => {
    getHomeGoodPriceData().then((res) => {
      dispatch(changeGoodPriceInfoAction(res));
    });
  }
);
const homeSlice = createSlice({
  name: "home",
  initialState: {
    goodPriceInfo: {},
  },
  reducers: {
    changeGoodPriceInfoAction(state, { payload }) {
      state.goodPriceInfo = payload;
    },
  },
});
export default homeSlice.reducer;
export const { changeGoodPriceInfoAction } = homeSlice.actions;
